home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / DylanTalk / SILIE Source / Sample.r < prev    next >
Encoding:
Text File  |  1992-06-18  |  6.0 KB  |  272 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple Sample Application
  6. #
  7. #    Sample
  8. #
  9. #    Sample.r    -    Rez Source
  10. #
  11. #    Copyright © Apple Computer, Inc. 1989-1990
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89    MPW 3.1
  18. #                1.03                02/90    MPW 3.2
  19. #
  20. #    Components:
  21. #                Sample.p            Feb.  1, 1990
  22. #                Sample.c            Feb.  1, 1990
  23. #                Sample.a            Feb.  1, 1990
  24. #                Sample.inc1.a        Feb.  1, 1990
  25. #                SampleMisc.a        Feb.  1, 1990
  26. #                Sample.r            Feb.  1, 1990
  27. #                Sample.h            Feb.  1, 1990
  28. #                [P]Sample.make        Feb.  1, 1990
  29. #                [C]Sample.make        Feb.  1, 1990
  30. #                [A]Sample.make        Feb.  1, 1990
  31. #
  32. #    Sample is an example application that demonstrates how to
  33. #    initialize the commonly used toolbox managers, operate 
  34. #    successfully under MultiFinder, handle desk accessories, 
  35. #    and create, grow, and zoom windows.
  36. #
  37. #    It does not by any means demonstrate all the techniques 
  38. #    you need for a large application. In particular, Sample 
  39. #    does not cover exception handling, multiple windows/documents, 
  40. #    sophisticated memory management, printing, or undo. All of 
  41. #    these are vital parts of a normal full-sized application.
  42. #
  43. #    This application is an example of the form of a Macintosh 
  44. #    application; it is NOT a template. It is NOT intended to be 
  45. #    used as a foundation for the next world-class, best-selling, 
  46. #    600K application. A stick figure drawing of the human body may 
  47. #    be a good example of the form for a painting, but that does not 
  48. #    mean it should be used as the basis for the next Mona Lisa.
  49. #
  50. #    We recommend that you review this program or TESample before 
  51. #    beginning a new application.
  52. ------------------------------------------------------------------------------*/
  53.  
  54.  
  55. #include "SysTypes.r"
  56. #include "Types.r"
  57.  
  58. #include "Sample.h"
  59.  
  60. resource 'vers' (1) {
  61.     0x02, 0x00, release, 0x00,
  62.     verUS,
  63.     "1.03",
  64.     "1.03, Copyright \251 Apple Computer, Inc. 1989-1990"
  65. };
  66.  
  67.  
  68. /* this is a definition for a resource which contains only a rectangle */
  69.  
  70. type 'RECT' {
  71.     rect;
  72. };
  73.  
  74.  
  75. /* we use an MBAR resource to conveniently load all the menus */
  76.  
  77. resource 'MBAR' (rMenuBar, preload) {
  78.     { mApple, mFile, mEdit };    /* four menus */
  79. };
  80.  
  81.  
  82. resource 'MENU' (mApple, preload) {
  83.     mApple, textMenuProc,
  84.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  85.     enabled, apple,
  86.     {
  87.         "About Sample…",
  88.             noicon, nokey, nomark, plain;
  89.         "-",
  90.             noicon, nokey, nomark, plain
  91.     }
  92. };
  93.  
  94. resource 'MENU' (mFile, preload) {
  95.     mFile, textMenuProc,
  96.     MenuItem12 | MenuItem5 | MenuItem6 ,                /* enable Quit only, program enables others */
  97.     enabled, "File",
  98.     {
  99.         "New",
  100.             noicon, "N", nomark, plain;
  101.         "Open",
  102.             noicon, "O", nomark, plain;
  103.         "-",
  104.             noicon, nokey, nomark, plain;
  105.         "Close",
  106.             noicon, "W", nomark, plain;
  107.         "Save",
  108.             noicon, "S", nomark, plain;
  109.         "Save As…",
  110.             noicon, nokey, nomark, plain;
  111.         "Revert",
  112.             noicon, nokey, nomark, plain;
  113.         "-",
  114.             noicon, nokey, nomark, plain;
  115.         "Page Setup…",
  116.             noicon, nokey, nomark, plain;
  117.         "Print…",
  118.             noicon, nokey, nomark, plain;
  119.         "-",
  120.             noicon, nokey, nomark, plain;
  121.         "Quit",
  122.             noicon, "Q", nomark, plain
  123.     }
  124. };
  125.  
  126. resource 'MENU' (mEdit, preload) {
  127.     mEdit, textMenuProc,
  128.     NoItems,                /* disable everything, program does the enabling */
  129.     enabled, "Edit",
  130.      {
  131.         "Undo",
  132.             noicon, "Z", nomark, plain;
  133.         "-",
  134.             noicon, nokey, nomark, plain;
  135.         "Cut",
  136.             noicon, "X", nomark, plain;
  137.         "Copy",
  138.             noicon, "C", nomark, plain;
  139.         "Paste",
  140.             noicon, "V", nomark, plain;
  141.         "Clear",
  142.             noicon, nokey, nomark, plain
  143.     }
  144. };
  145.  
  146.  
  147. /* this ALRT and DITL are used as an About screen */
  148.  
  149. resource 'ALRT' (rAboutAlert, purgeable) {
  150.     {40, 20, 160, 297},
  151.     rAboutAlert,
  152.     { /* array: 4 elements */
  153.         /* [1] */
  154.         OK, visible, silent,
  155.         /* [2] */
  156.         OK, visible, silent,
  157.         /* [3] */
  158.         OK, visible, silent,
  159.         /* [4] */
  160.         OK, visible, silent
  161.     }
  162. };
  163.  
  164. resource 'DITL' (rAboutAlert, purgeable) {
  165.     { /* array DITLarray: 5 elements */
  166.         /* [1] */
  167.         {88, 185, 108, 265},
  168.         Button {
  169.             enabled,
  170.             "OK"
  171.         },
  172.         /* [2] */
  173.         {8, 8, 24, 214},
  174.         StaticText {
  175.             disabled,
  176.             "Simple Sample (Traffic Light)"
  177.         },
  178.         /* [3] */
  179.         {32, 8, 48, 296},
  180.         StaticText {
  181.             disabled,
  182.             "Copyright © Apple Computer 1989-1990"
  183.         },
  184.         /* [4] */
  185.         {56, 8, 72, 136},
  186.         StaticText {
  187.             disabled,
  188.             "Brought to you by:"
  189.         },
  190.         /* [5] */
  191.         {80, 24, 112, 167},
  192.         StaticText {
  193.             disabled,
  194.             "Macintosh Developer  Technical Support"
  195.         }
  196.     }
  197. };
  198.  
  199.  
  200. /* this ALRT and DITL are used as an error screen */
  201.  
  202. resource 'ALRT' (rUserAlert, purgeable) {
  203.     {40, 20, 120, 260},
  204.     rUserAlert,
  205.     { /* array: 4 elements */
  206.         /* [1] */
  207.         OK, visible, silent,
  208.         /* [2] */
  209.         OK, visible, silent,
  210.         /* [3] */
  211.         OK, visible, silent,
  212.         /* [4] */
  213.         OK, visible, silent
  214.     }
  215. };
  216.  
  217.  
  218. resource 'DITL' (rUserAlert, purgeable) {
  219.     { /* array DITLarray: 3 elements */
  220.         /* [1] */
  221.         {50, 150, 70, 230},
  222.         Button {
  223.             enabled,
  224.             "OK"
  225.         },
  226.         /* [2] */
  227.         {10, 60, 30, 230},
  228.         StaticText {
  229.             disabled,
  230.             "Sample - Error occurred!"
  231.         },
  232.         /* [3] */
  233.         {8, 8, 40, 40},
  234.         Icon {
  235.             disabled,
  236.             2
  237.         }
  238.     }
  239. };
  240.  
  241.  
  242. resource 'WIND' (rWindow, preload, purgeable) {
  243.     {60, 40, 480, 480},
  244.     noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
  245. };
  246.  
  247.  
  248.  
  249. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  250.  
  251. resource 'SIZE' (-1) {
  252.     dontSaveScreen,
  253.     acceptSuspendResumeEvents,
  254.     enableOptionSwitch,
  255.     canBackground,                /* we can background; we don't currently, but our sleep value */
  256.                                 /* guarantees we don't hog the Mac while we are in the background */
  257.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  258.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  259.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  260.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  261.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  262.     reserved,
  263.     reserved,
  264.     reserved,
  265.     reserved,
  266.     reserved,
  267.     reserved,
  268.     reserved,
  269.     kPrefSize * 1024,
  270.     kMinSize * 1024    
  271. };
  272.